<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class CommonController extends Controller
{
    function nodeTree($arr, $id = 0, $level = 0) {
        static $array = array();
        foreach ($arr as $v) {
            if ($v['pid'] == $id) {
                $v['curriculum_name'] = $level;

                $array[] = $v;
                $this->nodeTree($arr,$v['id'],$level+1);
            }
        }
        return $array;
    }


}
